/*
 * Instruction46.java
 *
 * Created on March 22, 2007, 9:20 PM
 *
 * 
 
Shifts all bits of accumulator A one place to the right. Bit 7 is loaded from
the C status bit. The C bit is loaded from the least significant bit of A.
Rotate operations include the carry bit to allow extension of shift and
rotate operations to multiple bytes. For example, to shift a 24-bit value
one bit to the right, the sequence LSR HIGH, ROR MID, and ROR LOW
could be used where LOW, MID, and HIGH refer to the low-order,
middle, and high-order bytes of the 24-bit value, respectively.
 */

package moto9s12sim;

/**
 *
 * @author Fergus Earnshaw
 */
public class Instruction46 extends Instruction{
    
    /** Creates a new instance of Instruction46 */
    public Instruction46() {
        this.strAssemblyCode = "RORA";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("46",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        cpu.PC.inc();
        
        
        cpu.CC.setN(cpu.A.getUnsignedRegister() < 0);
        cpu.CC.setZ(cpu.A.getRegister() == 0);
        //cpu.CC.setV();
        //cpu.CC.setC();
        
        printInstruction(cpu);
        //I think the first invalid instruction should halt excution
        return true;
    }  
    
}
